<template>
  <div id="app">
    <img src="./assets/logo.png">
<!--    <router-view/>-->
    <p>h</p>
<!--    <Menu :menus="menus" :addMenu="addMenu"></Menu>-->
<!--<hello-world></hello-world>-->
<!--    <Menu :menus="menus" @addMenu="addMenu"></Menu>
    <Foot>
      <div slot="f">
        版权所有
      </div>
    </Foot>-->

<!--    <div>-->
<!--      <div class="menu">-->
<!--        <ul>-->
<!--          <li>-->
<!--            <router-link to="/index">首页</router-link>-->
<!--          </li>-->
<!--          <li>-->
<!--            <router-link to="/menu1">菜单1</router-link>-->
<!--          </li>-->
<!--        </ul>-->
<!--      </div>-->
<!--      <div class="content">-->
<!--        <keep-alive>-->
<!--          <router-view></router-view>-->
<!--        </keep-alive>-->

<!--      </div>-->
<!--    </div>-->
    <vuex1></vuex1>
  </div>
</template>

<script>

import  Pubsub from 'pubsub-js';
import HelloWorld from './components/HelloWorld.vue'
import Menu from './components/Menu.vue'
import  Foot from './components/Foot.vue'
import helloWorld from "./components/HelloWorld.vue";
import Vuex1 from './components/Vuex1.vue'


export default {
  name: 'App',
  components:{
    HelloWorld : HelloWorld,
    Menu:Menu,
    Foot:Foot,
    Vuex1:Vuex1
  },
  data(){
    return {
      menus:[
        {id:1,name:"科技"},
        {id:2,name:"文化"},
        {id:3,name:"政治"}
      ]
    }
  },
  methods:{
    addMenu(menu){
      this.menus.push(menu);
    }
  },
  mounted() {
    PubSub.subscribe('add',(msg,data) => {
      console.log("msg:"+msg);
      console.log("data:"+data);
      this.addMenu(data)
    })
  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}

  ul li{
    float: left;
    padding-left: 20px;
    list-style-type: none;
  }

  ul li a{
    text-decoration: none;
  }

  .content {
    clear: both;
    padding: 20px;
  }
</style>
